package net.apexes.demo.codegen.dslite.qvar;

import net.apexes.demo.codegen.dslite.entity.Feature;
import net.apexes.demo.codegen.dslite.qvar.base.QEntityBase;
import net.wafo.dslite.core.info.ForeignKey;
import net.wafo.dslite.core.info.Index;

import net.wafo.dslite.core.dsl.*;

/**
 * QFeature is a DSLite query type for Feature
 * @see Feature
 */
public class QFeature extends QEntityBase<Feature> {

    public static final QFeature $ = new QFeature("FEATURE");

    public final StringColumn name = varchar("NAME", 32).field("name").notNull().build();

    public final NumberColumn<Integer> seqOrder = integer("SEQ_ORDER").field("seqOrder").notNull().build();

    public final StringColumn featureGroupId = varchar("FEATURE_GROUP_ID", 22).field("featureGroupId").notNull().build();

    public final StringColumn templateId = varchar("TEMPLATE_ID", 22).field("templateId").notNull().build();

    public class Indexs {

        public final Index constraintIndexF0 = index("CONSTRAINT_INDEX_F0").column(featureGroupId).build();

        public final Index primaryKeyF0 = index("PRIMARY_KEY_F0").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public class ForeignKeys {

        public final ForeignKey constraintF06 = foreignKey(featureGroupId, "FEATURE_GROUP", "ID");

    }

    public final ForeignKeys fk = new ForeignKeys();

    public QFeature(String tableName) {
        super(Feature.class, tableName);
    }

    @Override
    public Feature newEntity() {
        return new Feature();
    }

    @Override
    public Object getFieldValue(Feature entity, String fieldName) {
        switch (fieldName) {
            case "name":
                return entity.getName();
            case "seqOrder":
                return entity.getSeqOrder();
            case "featureGroupId":
                return entity.getFeatureGroupId();
            case "templateId":
                return entity.getTemplateId();
            default:
                return super.getFieldValue(entity, fieldName);
        }
    }

    @Override
    public void setFieldValue(Feature entity, String fieldName, Object value) {
        switch (fieldName) {
            case "name":
                entity.setName((java.lang.String) value);
                break;
            case "seqOrder":
                entity.setSeqOrder((java.lang.Integer) value);
                break;
            case "featureGroupId":
                entity.setFeatureGroupId((java.lang.String) value);
                break;
            case "templateId":
                entity.setTemplateId((java.lang.String) value);
                break;
            default:
                super.setFieldValue(entity, fieldName, value);
                break;
        }
    }

}

